package io;

import java.io.*;


public class FileCopyTest {
    public static void main(String[] args) {
        InputStream fileInputStream=null;
        OutputStream outputStream= null;
        try {
            outputStream = new FileOutputStream("D:/2.jpg");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        byte[] bytes = new byte[1024*14];
        int len=0;
        try {
             fileInputStream = new FileInputStream("D:/1.jpg");
             while ((len=fileInputStream.read(bytes))!=-1){
                 outputStream.write(bytes,0,len);
             }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                outputStream.close();
                fileInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
